package org.rujue.modules.sys.entity;

import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAttribute;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import org.rujue.common.persistence.DataEntity;

/**
 * 字典管理
 */
@Data
public class Dict extends DataEntity<Dict> {

	private static final long serialVersionUID = 1L;
	/** 键值 */
	private String value;
	/** 标签名 */
	private String label;
	/** 类型 */
	private String type;
	/** 类别 */
	private String category;
	/** 描述 */
	private String description;
	/** 父级ID */
	private String parentId;

	public Dict() {
		super();
	}
	
	public Dict(String id){
		super(id);
	}
	
	public Dict(String value, String label){
		this.value = value;
		this.label = label;
	}
	
	@XmlAttribute
	@Length(min=1, max=100)
	public String getValue() {
		return value;
	}

	@XmlAttribute
	@Length(min=1, max=100)
	public String getLabel() {
		return label;
	}

	@Length(min=1, max=100)
	public String getType() {
		return type;
	}

	@XmlAttribute
	@Length(min=0, max=100)
	public String getDescription() {
		return description;
	}

	@NotNull
	public Integer getSort() {
		return sort;
	}

	@Length(min=1, max=100)
	public String getParentId() {
		return parentId;
	}

	@Override
	public String toString() {
		return label;
	}
}